JSGF.SpriteText = JSGF.inherit(JSGF.SpriteBase);

JSGF.SpriteText.prototype.additional = function(text) {
	this.type = "JSGF.SpriteText";
	if (this.width == null) {
		this.width = 0;
	}
	if (this.height == null) {
		this.height = 10;
	}
	this.text = "";
	this.color = "#000000";
	this.font = "'ＭＳ Ｐゴシック','Hiragino Kaku Gothic ProN','ヒラギノ角ゴ ProN W3'"
	if (text != null && typeof(text) == "string") {
		this.text = text;
		this.width = text.length * (this.height / 2);
	}
}

JSGF.SpriteText.prototype.draw = function(context) {
	if (this.text != "") {
		if (this.alpha != 1.0) {
			context.globalAlpha = this.alpha;
		}
		context.font = this.height + "px " + this.font;
		this.width = context.measureText(this.text).width;
		context.fillStyle = this.color;
		context.fillText(this.text ,this.x ,this.y);
		if (this.alpha != 1.0) {
			context.globalAlpha = 1.0;
		}
	}
}

////////////////////////////////////////
//Public
////////////////////////////////////////

delete JSGF.SpriteText.prototype.setWidth;
JSGF.SpriteText.prototype.setText = function(text) {
	this.text = text;
}

JSGF.SpriteText.prototype.getText = function() {
	return this.text;
}

JSGF.SpriteText.prototype.setColor = function(color) {
	this.color = color;
}

JSGF.SpriteText.prototype.getColor = function() {
	return this.color;
}

JSGF.SpriteText.prototype.setFont = function(font) {
	this.font = font;
}

JSGF.SpriteText.prototype.getFont = function() {
	return this.font;
}

////////////////////////////////////////
// definition by user
////////////////////////////////////////

